﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MySql.Data.MySqlClient;
using MySql.Data.Types;
using TAMS;

namespace TAMS.Faculty_Member
{
    public partial class FacultyMember_Welcome : System.Web.UI.Page
    {
        MySqlConnection conn;
        MySqlCommand sqlCommand;
        MySqlDataReader readVals;
        string strProvider = Resource1.databaseConnection;
        string id;

        protected void Page_Load(object sender, EventArgs e)
        {
            id = (string)Session["userName"];

            if (id == null)
                Response.Redirect("../login.aspx");

            // Connect to the Database
            conn = new MySqlConnection(strProvider);
            conn.Open();

            string strSQL = "SELECT * FROM Staff S WHERE S.fsid = " + id;

            sqlCommand = new MySqlCommand(strSQL, conn);
            readVals = sqlCommand.ExecuteReader();

            while (readVals.Read())
                WelcomeLabel.Text = "Welcome " + readVals.GetString("fs_name") + "! Select from table to the left. <br>";
        }
    }
}